package com.ffapp.f9164.td.util;

import android.text.TextUtils;

import com.ffapp.f9164.td.basis.BasisApp;

import my.MySharedPreferences;

/**
 * Created by niany on
 */

public class MyUtils {

    private static final String SP_APPID= "sp_appid";
    private static final String SP_AUTHKEY= "sp_authkey";
    private static final String SP_AMBIENT= "sp_ambient";


    public static String getImageUrlBySize(String urlorg,int with,int height){
        if(TextUtils.isEmpty(urlorg))return "";
        if(urlorg.endsWith(".jpg")){
          return   urlorg+"@w"+with+"_h"+height+".jpg";
        }else if(urlorg.endsWith(".png")){
            return   urlorg+"@w"+with+"_h"+height+".png";
        }else{
            return   urlorg+"@w"+with+"_h"+height+".jpg";
        }
    }


    public static String getAppid( ){
        MySharedPreferences msp = new MySharedPreferences(BasisApp.getInstance());
        return  msp.getString(SP_APPID,"10001");
    }
    public static void putAppid( String appid){
        MySharedPreferences msp = new MySharedPreferences(BasisApp.getInstance());
          msp.putString(SP_APPID,appid);
    }

    public static String getAuthKey( ){
        MySharedPreferences msp = new MySharedPreferences(BasisApp.getInstance());
        return  msp.getString(SP_AUTHKEY,"");
    }

    public static String getAmbient( ){
        MySharedPreferences msp = new MySharedPreferences(BasisApp.getInstance());
        return  msp.getString(SP_AMBIENT,"");
    }

    public static void putAuthKey( String key){
        MySharedPreferences msp = new MySharedPreferences(BasisApp.getInstance());
        msp.putString(SP_AUTHKEY,key);
    }

}
